<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>基础</title>
</head>
<body>
<div id="demo"></div>
<script src="../js/libs/vue.js"></script>
<script>
    new Vue({
        el: '#demo'
    });
    //定义一个混合对象
    var myMixin = {
        created: function () {
            this.hello();
        },
        methods: {
            hello: function () {
                console.log('hello from mixin');
            }
        }
    };
    //定义一个组件，使用这个混合对象
    var Component = Vue.extend({
        mixins: [myMixin]
    });
    var component = new Component();
</script>
</body>
</html>